ci: migrate the centralized add-license hook to the org .github repository#61
ci: migrate the centralized add-license hook to the org .github repository#61mc-nv wants to merge 18 commits into
Conversation
Add tools/add_spdx_header.py as a centralized pre-commit hook that migrates each source file to the two-line SPDX header the first time it is touched (maintain / migrate legacy NVIDIA BSD header / insert). Exclude .github/ from add-license so GitHub issue/PR templates keep their YAML frontmatter first. Make add-license read the LICENSE file without rewriting its copyright year — consumer repos' LICENSE files must never be modified by hooks. Requires tagging v0.2.0 after merge. Also align this repository with the shared pre-commit baseline and GitHub templates. TRI-1100
CI here must validate the hook code being merged rather than an already-published tag; consumer repositories keep referencing rev: v0.2.0. TRI-1100
Legal's Copyright / License Header Guidance specifies the SPDX form without a comma after the year: SPDX-FileCopyrightText: Copyright (c) <year> NVIDIA CORPORATION & AFFILIATES. All rights reserved. Emit that form from add_spdx_header.py, keep both hooks tolerant of the legacy comma variant, and normalize the headers introduced by this change. TRI-1100
Human-readable type labels with enforced descriptions and colors. TRI-1100
The add-license hook now fails when the LICENSE copyright year is stale. TRI-1100
Workflow files are license-processed again (only templates excluded); refresh the stale copyright year this repo's pre-commit workflow carried. TRI-1100
|
Consider dropping tags in this repository (v0.1.0, v0.2.0, etc.) as they are no longer used. |
|
Done for the safe subset: |
Grant issues:write to the labeling job (review feedback). TRI-1100
Greptile SummaryThis PR migrates the
Confidence Score: 5/5Safe to merge — the changes are a straightforward hook migration and CI modernisation with no functional regressions. All four changed files implement clean, well-scoped changes: the add-license hook moves to the org .github repo at a pinned immutable tag, the pre-commit workflow gains space-safe file filtering and a config-keyed cache, and the new conventional-pr.yml caller correctly guards pull_request_target to fork-only PRs. No logic that could silently break existing consumers was altered. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Dev as Developer
participant GH as GitHub Actions
participant PreCommitWF as pre-commit.yml
participant ConvPRWF as conventional-pr.yml
participant OrgWF as .github reusable workflow (v1.4.3)
participant PC as pre-commit (local cache)
Dev->>GH: Open / push PR
GH->>PreCommitWF: trigger (pull_request)
PreCommitWF->>PreCommitWF: "checkout (fetch-depth=2)"
PreCommitWF->>PC: restore cache (~/.cache/pre-commit keyed on config hash)
PreCommitWF->>PreCommitWF: "git diff HEAD^1 HEAD (null-delimited, --diff-filter=d)"
PreCommitWF->>PC: pre-commit run --files changed files
PC-->>PreCommitWF: pass / fail (show diff on failure)
GH->>ConvPRWF: trigger (pull_request OR pull_request_target)
Note over ConvPRWF: if guard: same-repo → pull_request, fork → pull_request_target
ConvPRWF->>OrgWF: "uses conventional-pr.yml@v1.4.3 (permissions: PR write, issues write)"
OrgWF->>GH: validate PR title (Conventional Commits)
OrgWF->>GH: apply / remove labels via API
OrgWF-->>ConvPRWF: result
Dev->>Dev: git commit (local)
Note over Dev,PC: commit-msg hook fires (conventional-pre-commit v4.4.0)
Dev->>PC: validate commit message format
PC-->>Dev: pass / fail
Reviews (2): Last reviewed commit: "ci: harden CI workflows and configs per ..." | Re-trigger Greptile |
- conventional-pr stub: dual pull_request/pull_request_target triggers so fork PRs from external contributors get labeled too (the reusable workflow never checks out PR code); explicit contents:read; pinned v1.4.3. - pre-commit workflow: robust modified-files runner (null-delimited paths, deletion-only PRs handled, deleted paths filtered, no undocumented -r flag, cache keyed on config hash). - flake8 args quoted correctly (the flow-scalar form split at commas and silently reduced the select list). - hooks pinned to .github v1.4.3. TRI-1100
|
Closing: the team is moving away from centralized org-level configuration in favor of per-repository self-contained setups (see triton-inference-server/server#8897 for the first decentralized implementation). Branch retained for reference. TRI-1100 |
What does the PR do?
Migrates the centralized
add-licensepre-commit hook (definition +tools/add_copyright.py) out of this repository into the org-wide defaults repo triton-inference-server/.github (see triton-inference-server/.github#5), so hooks, templates, issue routing, and reusable workflows live under one roof with a single tag line.Existing consumers pinned to this repository's
v0.xtags keep working — tags are immutable; new consumers reference.github@v1.4.3. This repository itself becomes a plain consumer, aligned with the shared baseline (conventional-commit validation, modified-files CI, org-wide templates, conventional-pr caller stub).Depends on triton-inference-server/.github#5 being merged and tagged (current:
v1.4.3).Related Issues / PRs
Related PRs:
Test plan
pre-commit validate-configpasses; hooks pass on the PR diff with the centralized hooks pinned to the .github branch SHA.Caveats
v0.2.xtags remain in place for any external consumer; they can be retired once nothing references them.Checklist
<commit_type>: <Title>(conventional commit)